package day03;
//此类时用于验证数据运算的测试demo
public class Mathematics {
    //输入main方法，程序的主入口
    public static void main(String[] args) {
        //验证算数运算符 + - * / %(取余数)

        //验证加法运算 +
        int a = 1;
        int b = 2;
        System.out.println(a+b); //输出3
        System.out.println(a+5); //输出6
        System.out.println(2+3); //输出5

        //验证减法  -
        int c =5;
        int d=4;
        System.out.println(c-d); //输出1
        System.out.println(c-2); //输出3
        System.out.println(7-5); //输出2

        //验证乘法  *(按shift+8)
        int e =5;
        System.out.println(e*b); //输出10
        System.out.println(2*b); //输出4
        System.out.println(2*3); //输出6

        //除法验证  /
        //整型的除法，只会保留整数位
        System.out.println(e/b); //输出2
        System.out.println((double)(e/b)); //输出2.0
        System.out.println((double)e/b); //输出2.5

        //求模取余% (shift+5)
        double x=6.0;
        double y=2.0;
        System.out.println(x%y);  //输出余数0.0
        System.out.println(x%4);  //输出余数2.0
        System.out.println(3.0%4.0);//输出余数3.0

        


    }
}
